<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>活动管理</title>
    <#include "/include/resource.html"/>
    <script type="application/javascript">
            function gotoAdvertisingEdit(){

                window.location= '${base}/admin/admin_advertising/add/';
            }
            function unPublishAd(advId){

                bootbox.confirm("您确认delete此条活动吗？", function (result) {
                    if (result) {

                        $.ajax({
                            type: "POST",
                            url: "${base}/admin/admin_advertising/"+advId,
                            dataType: "json",
                            success: function(data){

                                if(typeof(data)!='undefined'){

                                    $('#myModal').modal('show');

                                }
                            },
                            error:function(){
                                alert("error");
                            }
                        });
                    }
                });

            }
            function gotoAdvList(){

                window.location= '${base}/admin/admin_advertising/list';
            }
    </script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <style>
        .example-modal .modal {
            position: relative;
            top: auto;
            bottom: auto;
            right: auto;
            left: auto;
            display: block;
            z-index: 1;
        }

        .example-modal .modal {
            background: transparent !important;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "/include/header.html"/>
    <!-- Left side column. contains the logo and sidebar -->
    <#include "/include/main-sidebar.html"/>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                优惠活动列表
                <small>优惠活动</small>
            </h1>
            <ol class="breadcrumb">
                <li><i class="fa fa-dashboard"></i> 优惠活动列表</li>
                <li class="active">优惠活动</li>
            </ol>
        </section>

        <!-- Main content -->
            <section class="content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box">
                            <div class="box-header with-border">
                                <h3 class="box-title">优惠活动列表</h3>
                                <a type="button" class="btn btn-block btn-primary btn-sm"
                                        style="display: block;width :60px;float: right;margin-right: 5px" href="${base}/admin/admin_advertising/edit">Add</a>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body">
                                <form id="tableForm" method="post" class="form-horizontal" action="${base}/admin/admin_advertising/list">
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-md-2">
                                                <label for="inputEmail3" class="col-md-5 control-label">标题：</label>
                                                <div class="col-md-7" style="padding: 0px;">
                                                    <input type="text" class="form-control" value="${(title)!''}" name="title" id="inputEmail3" placeholder="标题">
                                                </div>
                                            </div>
                                            <div class="col-md-2" style="padding: 0px;">
                                                <label class="col-md-5 control-label">Add日期：</label>
                                                <div class="input-group date col-md-7">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input type="text" class="form-control pull-right" name="dateRangeBe" value="${(dateRangeBe)!''}" id="datepicker">
                                                </div>
                                            </div>
                                            <div class="col-md-2" style="padding: 0px;">
                                                <label class="col-md-2 control-label">--</label>
                                                <div class="input-group date col-md-7">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input type="text" class="form-control pull-right" name="dateRangeEn" value="${(dateRangeEn)!''}"  id="datepicker_">
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <button type="button" onclick="HF.query('tableForm');" class="btn btn-primary">Query</button>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                                <div class="form-group">
                                    <table class="table table-bordered">
                                        <tr>
                                            <th>SequenceNo</th>
                                            <th>标题</th>
                                            <th>产品分类</th>
                                            <th>创建时间</th>
                                            <th>创建人</th>
                                            <th>Status</th>
                                            <th>SequenceNo</th>

                                            <th>ActionList</th>
                                        </tr>
                                        <#if list??&&list?size gt 0>
                                            <#list list as t>
                                                <tr>
                                                    <td>${t_index+1}</td>
                                                    <td>${(t.title)!""}</td>
                                                    <td>${(t.productType)!""}</td>
                                                    <td>${nav.getDate((t.createDate)!"")}</td>
                                                    <td>${(t.createUser)!""}</td>
                                                    <td>${nav.getAdvertisingStatus((t.status)!"")}</td>
                                                    <td>${(t.orderNo)!""}</td>
                                                    <td>

                                                        <div class="btn-group">
                                                            <button type="button" class="btn btn-default">..</button>
                                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                                                <span class="caret"></span>
                                                                <span class="sr-only">Toggle Dropdown</span>
                                                            </button>
                                                            <ul class="dropdown-menu" role="menu">
                                                                <li><a href="${base}/admin/admin_advertising/edit?id=${t.id}">edit</a></li>
                                                                <li><a href="#" onclick="unPublishAd(${t.id})">delete</a></li>
                                                            </ul>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </#list>
                                        </#if>
                                        </table>
                                    </div>
                                </div>
                        <!-- /.box-body -->
                        <@p.pager pageNo=pageNo pageSize=pageSize totalCount=totalCount />
                    </div>
                    <!-- /.box -->
                </div>
    </div>
    </section>
    <!-- /.content -->
</div>
<!-- 弹出窗口 -->
<div class="modal fade" id="myModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">Details</h4>
            </div>
            <div class="modal-body">
                <p>ActionList Success!&hellip;</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal" onclick="gotoAdvList()">Close</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
    <div class="pull-right hidden-xs">
        <b>Version</b> 2.4.0
    </div>
    <strong>Copyright &copy; 2014-2016 <a href="https://adminlte.io">Almsaeed Studio</a>.</strong> All rights
    reserved.
</footer>
<div class="control-sidebar-bg"></div>
</div>
<#include "/include/js_footer.html"/>
<script type="application/javascript">
    $(function () {

//        $('#reservation').daterangepicker();
//      //  $('#reservation').daterangepicker({autoUpdateInput:false});
//        $('.reservation').daterangepicker({
//
//            startDate:'', endDate:''})
        $.fn.datepicker.defaults.format = "yyyy-mm-dd";
        $('#datepicker').datepicker({
            autoclose: true
        })

        $('#datepicker_').datepicker({
            autoclose: true
        })

    })
</script>

</body>

</html>
